home *** CD-ROM | disk | FTP | other *** search
/ Aminet 49 / Aminet 49 (2002)(GTI - Schatztruhe)[!][Jun 2002].iso / Aminet / util / libs / ttrender.lha / ttrender-2.0 / Developer / source / base / ftnames.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-06  |  2.6 KB  |  78 lines

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*  ftnames.c                                                              */
  4. /*                                                                         */
  5. /*    Simple interface to access SFNT name tables (which are used          */
  6. /*    to hold font names, copyright info, notices, etc.) (body).           */
  7. /*                                                                         */
  8. /*    This is _not_ used to retrieve glyph names!                          */
  9. /*                                                                         */
  10. /*  Copyright 1996-2001 by                                                 */
  11. /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
  12. /*                                                                         */
  13. /*  This file is part of the FreeType project, and may only be used,       */
  14. /*  modified, and distributed under the terms of the FreeType project      */
  15. /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
  16. /*  this file you indicate that you have read the license and              */
  17. /*  understand and accept it fully.                                        */
  18. /*                                                                         */
  19. /***************************************************************************/
  20.  
  21.  
  22. #include <ft2build.h>
  23. #include FT_SFNT_NAMES_H
  24. #include FT_INTERNAL_TRUETYPE_TYPES_H
  25.  
  26.  
  27. #ifdef TT_CONFIG_OPTION_SFNT_NAMES
  28.  
  29.  
  30.   /* documentation is in ftnames.h */
  31.  
  32.   FT_EXPORT_DEF( FT_UInt )
  33.   FT_Get_Sfnt_Name_Count( FT_Face  face )
  34.   {
  35.     return (face && FT_IS_SFNT( face )) ? ((TT_Face)face)->num_names : 0;
  36.   }
  37.  
  38.  
  39.   /* documentation is in ftnames.h */
  40.  
  41.   FT_EXPORT_DEF( FT_Error )
  42.   FT_Get_Sfnt_Name( FT_Face       face,
  43.                     FT_UInt       index,
  44.                     FT_SfntName  *aname )
  45.   {
  46.     FT_Error  error = FT_Err_Invalid_Argument;
  47.  
  48.  
  49.     if ( aname && face && FT_IS_SFNT( face ) )
  50.     {
  51.       TT_Face  ttface = (TT_Face)face;
  52.  
  53.  
  54.       if ( index < (FT_UInt)ttface->num_names )
  55.       {
  56.         TT_NameRec*  name = ttface->name_table.names + index;
  57.  
  58.  
  59.         aname->platform_id = name->platformID;
  60.         aname->encoding_id = name->encodingID;
  61.         aname->language_id = name->languageID;
  62.         aname->name_id     = name->nameID;
  63.         aname->string      = (FT_Byte*)name->string;
  64.         aname->string_len  = name->stringLength;
  65.  
  66.         error = FT_Err_Ok;
  67.       }
  68.     }
  69.  
  70.     return error;
  71.   }
  72.  
  73.  
  74. #endif /* TT_CONFIG_OPTION_SFNT_NAMES */
  75.  
  76.  
  77. /* END */
  78.